<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="kissdata">


    <meta name="subtitle" content="人生笔记">


    <meta name="description" content="南邮计算机学院2021毕业生王鹏的介绍，cs软件工程专业">


    <meta name="keywords" content="wangpeng 王鹏 南邮 南京">


<title>💥 | Centos7 搭建短视频平台 | 王鹏的小岛</title>



    <link rel="icon" href="/myIcon.ico">




    <!-- stylesheets list from _config.yml -->
    
    <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
    <script src="/js/script.js"></script>
    
    <script src="/js/tocbot.min.js"></script>
    



    
    
        <!-- MathJax配置，可通过单美元符号书写行内公式等 -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
    "HTML-CSS": {
        preferredFont: "TeX",
        availableFonts: ["STIX","TeX"],
        linebreaks: { automatic:true },
        EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
    },
    tex2jax: {
        inlineMath: [ ["$", "$"], ["\\(","\\)"] ],
        processEscapes: true,
        ignoreClass: "tex2jax_ignore|dno",
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
        equationNumbers: { autoNumber: "AMS" },
        noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } },
        Macros: { href: "{}" }
    },
    messageStyle: "none"
    });
</script>
<!-- 给MathJax元素添加has-jax class -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>
<!-- 通过连接CDN加载MathJax的js代码 -->
<script type="text/javascript" async
        src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script>


    


<meta name="generator" content="Hexo 7.0.0"></head>

<body>
    <script>
        // this function is used to check current theme before page loaded.
        (() => {
            const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
            const isDark = currentTheme === 'dark';
            const pagebody = document.getElementsByTagName('body')[0]
            if (isDark) {
                pagebody.classList.add('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Dark"
            } else {
                pagebody.classList.remove('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Light"
            }
        })();
    </script>

    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">侠之大者</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/update/mystate">Career</a>
                
                    <a class="menu-item" href="/category">Legend</a>
                
                    <a class="menu-item" href="/about">Me</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">侠之大者</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/update/mystate">Career</a>
                
                    <a class="menu-item" href="/category">Legend</a>
                
                    <a class="menu-item" href="/about">Me</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
            <div class="main">
                <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">Expand all</a>
        <a onclick="go_top()">Back to top</a>
        <a onclick="go_bottom()">Go to bottom</a>
    </div>
</div>

<script>
    var tocbot_timer;
    var DEPTH_MAX = 6; // 为 6 时展开所有
    var tocbot_default_config = {
        tocSelector: '.tocbot-list',
        contentSelector: '.post-content',
        headingSelector: 'h1, h2, h3, h4, h5',
        orderedList: false,
        scrollSmooth: true,
        onClick: extend_click,
    };

    function extend_click() {
        clearTimeout(tocbot_timer);
        tocbot_timer = setTimeout(function() {
            tocbot.refresh(obj_merge(tocbot_default_config, {
                hasInnerContainers: true
            }));
        }, 420); // 这个值是由 tocbot 源码里定义的 scrollSmoothDuration 得来的
    }

    document.ready(function() {
        tocbot.init(obj_merge(tocbot_default_config, {
            collapseDepth: 1
        }));
    });

    function expand_toc() {
        var b = document.querySelector('.tocbot-toc-expand');
        var expanded = b.getAttribute('data-expanded');
        expanded ? b.removeAttribute('data-expanded') : b.setAttribute('data-expanded', true);
        tocbot.refresh(obj_merge(tocbot_default_config, {
            collapseDepth: expanded ? 1 : DEPTH_MAX
        }));
        b.innerText = expanded ? 'Expand all' : 'Collapse all';
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

    function obj_merge(target, source) {
        for (var item in source) {
            if (source.hasOwnProperty(item)) {
                target[item] = source[item];
            }
        }
        return target;
    }
</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">💥 | Centos7 搭建短视频平台</h1>
            
                <div class="post-meta">
                    
                        Author: <a itemprop="author" rel="author" href="/">kissdata</a>
                    

                    
                        <span class="post-time">
                        Date: <a href="#">Sep 19, 2022&nbsp;&nbsp;0:00</a>
                        </span>
                    
                    
                        <span class="post-category">
                    Category:
                            
                                <a href="/categories/Deploy/">Deploy</a>
                            
                        </span>
                    
                </div>
            
        </header>

        <div class="post-content">
            <p>环境：CentOS7 + shida</p>
<p>没有成功，这个开源库可能是Mac项目，<strong>is not a project for centOS, it need glibc2.27</strong></p>
<p>【开源库地址】Github  <code>https://github.com/tnfe/shida</code> </p>
<blockquote>
<p>ps: Gitee上的备份库需要额外编译安装 ffmpeg。Github上的最新版不用自己编译安装ffmpeg。</p>
</blockquote>
<p>尝试的运行环境版本：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">  tools      version</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">-- -- -- | -- -- -- <span class="comment">#</span></span></span><br><span class="line">· node       16.1.0</span><br><span class="line">· npm	     7.7.6</span><br><span class="line">· mongodb    5.0.12</span><br></pre></td></tr></table></figure>

<p>【操作方法】</p>
<p>root用户操作：安装 gcc-9、git、nodejs、python3、mongodb</p>
<p>普通用户操作：npm</p>
<h2 id="一、升级工具链"><a href="#一、升级工具链" class="headerlink" title="一、升级工具链"></a>一、升级工具链</h2><p>从安装 gcc开始，编译ffmpeg依赖yasm。</p>
<h3 id="1-1-更新gcc4-8"><a href="#1-1-更新gcc4-8" class="headerlink" title="1.1 更新gcc4.8"></a>1.1 更新gcc4.8</h3><p>这里选择 <code>gcc9</code>，防止后续升级GLibc时出问题。参考 📗 <a href="/2022/10-2/knowledge_gcc/">Linux更新GCC</a></p>
<h3 id="1-2-查看链接库版本"><a href="#1-2-查看链接库版本" class="headerlink" title="1.2 查看链接库版本"></a>1.2 查看链接库版本</h3><p>查看lib链接库版本有两个方法：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">locate libstdc++.so.6</span><br><span class="line">find / -name libstdc++.so.6*   // 比较慢，但是优先使用</span><br></pre></td></tr></table></figure>

<p>如果没有多余的操作，以上两个命令显示结果一样。上传了没有用到的版本后，find命令更全面显示你有哪些so在本地。</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">rz   <span class="comment"># 上传下载的版本</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">cp</span> libstdc++.so.6.0.26 /usr/lib64/</span><br><span class="line">find / -name libstdc++.so.6*   <span class="comment"># 确认移动到了lib64目录</span></span><br><span class="line"><span class="built_in">rm</span> -rf /usr/lib64/libstdc++.so.6</span><br><span class="line"><span class="built_in">ln</span> -s /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6</span><br><span class="line"></span><br><span class="line">strings /usr/lib64/libstdc++.so.6 | grep CXXABI <span class="comment"># 确认多出了1.3.9</span></span><br><span class="line">strings /usr/lib64/libc.so.6 | grep GLIBC_1</span><br><span class="line">strings /usr/lib64/libc.so.6 | grep GLIBC_2     <span class="comment"># 确认有2.27</span></span><br></pre></td></tr></table></figure>

<p>模块需要 <code>CXXABI_1.3.9</code> ，Centos7默认版本知道 <code>CXXABI_1.3.7</code> </p>
<h3 id="1-3-编译升级GLIBC"><a href="#1-3-编译升级GLIBC" class="headerlink" title="1.3 编译升级GLIBC"></a>1.3 编译升级GLIBC</h3><p>Mac上的项目默认要2.27，Centos7不支持。前面更新的so6.0.26只能装到 GliBC2.17，项目需要2.28。还缺，需要重新编译下载。<a target="_blank" rel="noopener" href="http://mirrors.nju.edu.cn/gnu/libc/glibc-2.27.tar.xz">http://mirrors.nju.edu.cn/gnu/libc/glibc-2.27.tar.xz</a></p>
<p>【安装编译环境】</p>
<p>需要 bison、make4、python3.10</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">yum -y install bison</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">升级make</span></span><br><span class="line">wget https://ftp.gnu.org/gnu/make/make-4.3.tar.gz --no-check-certificate</span><br><span class="line">tar -xzvf make-4.*</span><br><span class="line">cd make-4.*</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建编译目录</span></span><br><span class="line">mkdir -p /usr/local/make</span><br><span class="line">chmod -R 777 /usr/local/make</span><br><span class="line">./configure  --prefix=/usr/local/make</span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">软链接</span></span><br><span class="line">cd /usr/bin</span><br><span class="line">mv make make.bakck</span><br><span class="line">ln -sv /usr/local/make/bin/make /usr/bin/make</span><br><span class="line"></span><br><span class="line">make -v # 确认已升级</span><br></pre></td></tr></table></figure>



<p>有的文章说要安装autoconf，已验证无效。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz</span><br></pre></td></tr></table></figure>



<p>【保存LD_LIBRARY_PATH内容】</p>
<p>configure 提示报错：checking LD_LIBRARY_PATH variable… contains current directory</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">echo $LD_LIBRARY_PATH</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将以下内容保存</span></span><br><span class="line">/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/xdev/lib64:/opt/xdev/lib:/usr/lib64/mysql:</span><br><span class="line"></span><br><span class="line">LD_LIBRARY_PATH=   # 清空</span><br></pre></td></tr></table></figure>

<p>编译安装成功后重新添加 LD_LIBRARY_PATH</p>
<p>【编译升级】</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">wget http://mirrors.nju.edu.cn/gnu/libc/glibc-2.29.tar.gz</span><br><span class="line">tar -xzvf glibc-2.2*</span><br><span class="line">cd glibc-2.2*</span><br><span class="line">mkdir build</span><br><span class="line">chmod -R 777 build</span><br><span class="line">cd build</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>【收尾】xshell进入报错。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">//TODO</span><br></pre></td></tr></table></figure>



<h2 id="二、安装运行环境"><a href="#二、安装运行环境" class="headerlink" title="二、安装运行环境"></a>二、安装运行环境</h2><h3 id="2-1-安装python3"><a href="#2-1-安装python3" class="headerlink" title="2.1 安装python3"></a>2.1 安装python3</h3><p>前面如果需要编译升级Glibc，则已经安装了，此步跳过。</p>
<p>参考 《操作步骤-搭建工作用的Linux》 <a target="_blank" rel="noopener" href="https://ae85.gitee.io/2022/09-12/review_centos7/"> 安装python环境</a></p>
<h3 id="2-2-安装-mongo"><a href="#2-2-安装-mongo" class="headerlink" title="2.2 安装 mongo"></a>2.2 安装 mongo</h3><p>g网 <a target="_blank" rel="noopener" href="https://www.mongodb.com/try/download/community">MongoDB Community Download</a> 安装参考 📗 <a href="/2022/10-3/centos_sql/">Centos7 安装 mongo5</a></p>
<h3 id="2-3-安装-npm"><a href="#2-3-安装-npm" class="headerlink" title="2.3 安装 npm"></a>2.3 安装 npm</h3><p><code>root账户</code> 安装，选择 v16.1.0 版本</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">wget https://nodejs.org/download/release/v16.1.0/node-v16.1.0-linux-x64.tar.xz</span><br><span class="line">tar -xf node-v16.* -C /usr/local</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">换名</span></span><br><span class="line">rm -rf /usr/local/node-v16</span><br><span class="line">mv /usr/local/node-v16.* /usr/local/node-v16</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">建立软链接</span></span><br><span class="line">cd /usr/local/node-*/bin   # 直接一步到 bin目录</span><br><span class="line">ln -s /usr/local/node-*/bin/node  /usr/local/bin/node</span><br><span class="line">ln -s /usr/local/node-*/bin/npm  /usr/local/bin/npm</span><br></pre></td></tr></table></figure>

<p>权限全开，</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod -R 777 /usr/local/node-v16*</span><br></pre></td></tr></table></figure>

<p>全局使用npm时需要在该lib子目录下创建子目录，通过系统调研mkdir的方式。不打开会报错 <code>permission denied</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">npm install -g yarn</span><br><span class="line">vim /etc/profile</span><br><span class="line">export PATH=$PATH:/usr/local/node-v16/bin</span><br><span class="line">. /etc/profile</span><br></pre></td></tr></table></figure>

<p>安装vue</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">原版源 https://registry.npmjs.org/</span> </span><br><span class="line">npm install -g cnpm --registry=https://registry.npm.taobao.org</span><br><span class="line">ln -s /usr/local/node-v16/bin/cnpm /usr/local/bin/cnpm</span><br><span class="line">cnpm install -g vue-cli</span><br><span class="line">ln -s /usr/local/node-v16/bin/vue /usr/local/bin/vue</span><br><span class="line"></span><br><span class="line">vue -V 	# 确认安装, v要大写</span><br></pre></td></tr></table></figure>

<p>收尾</p>
<p>事先搞定swaper,  规定版本5.2</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">npm install -g swiper@5.2.0 --ignore-scripts</span><br><span class="line">npm install -g vue-awesome-swiper@4.1.1 --save</span><br><span class="line"></span><br><span class="line">npm install node-pre-gyp node-gyp -g # 防止提示安装python</span><br></pre></td></tr></table></figure>



<h2 id="三、开源库"><a href="#三、开源库" class="headerlink" title="三、开源库"></a>三、开源库</h2><blockquote>
<p> 后续安装全部以 普通用户的状态执行</p>
</blockquote>
<p>先 <code>普通用户</code> 克隆项目到 home目录，</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> --depth 2 https://github.com/tnfe/shida.git</span><br></pre></td></tr></table></figure>

<p>不要用 root用户克隆到 &#x2F;root&#x2F;Downloads目录，普通用户进不去。</p>
<p>删除配置锁 json文件，</p>
<p><code>npm i</code> 前先弄好swaper。</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 防止node版本影响node-sass</span></span><br><span class="line">npm uninstall node-sass</span><br><span class="line">npm install node-sass --save-dev  <span class="comment"># 安装最新版</span></span><br><span class="line"><span class="built_in">rm</span> -rf node_modules</span><br><span class="line"></span><br><span class="line">npm install node-pre-gyp node-gyp -g <span class="comment"># 防止提示安装pythonll</span></span><br></pre></td></tr></table></figure>

<p>然后 <code>npm i</code></p>
<h3 id="启动-客户端"><a href="#启动-客户端" class="headerlink" title="启动 客户端"></a>启动 客户端</h3><p>npm run dev-client</p>
<p>再热更新</p>
<h3 id="启动-服务端"><a href="#启动-服务端" class="headerlink" title="启动 服务端"></a>启动 服务端</h3><p>&#x2F;&#x2F; </p>
<h2 id="附-参考"><a href="#附-参考" class="headerlink" title="附 参考"></a>附 参考</h2><p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/2021784">Centos 7 升级 Glibc-2.28</a> 2022.6</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/dm569263708/article/details/125201043">Centos 7 安装 Python3.10</a> 2022.7</p>

        </div>

        
            <section class="post-copyright">
                
                
                
                
                     <p class="copyright-item">
                         <span>Slogan:</span>
                         <span>人生三大错觉：我躲得过去，我能反杀，是不是<strong>喜欢我?</strong></span>
                     </p>
                

            </section>
        
        <section class="post-tags">
            <div>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
                <span>· </span>
                <a href="/">home</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2022/10-3/centos_sql/">开发环境 | CentOS 安装各种数据库</a>
            
            
            <a class="next" rel="next" href="/2022/09-5/review_code/">代码写法注意点</a>
            
        </section>


    </article>
</div>

            </div>
            <footer id="footer" class="footer">
    <div class="copyright">
        <span>187-9597-5517 &nbsp; 王鹏 @ <a href="https://cs.njupt.edu.cn/" target="_blank">njupt</a</span>
    </div>
</footer>

    </div>
</body>

</html>